package org.zhxy.core.system.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.zhxy.common.config.ServiceFactory;
import org.zhxy.common.response.PageResult;
import org.zhxy.common.response.Result;
import org.zhxy.common.response.ResultCode;
import org.zhxy.entity.system.Dictionary;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/dictionary")
public class DictionaryController {


    @RequestMapping(value = "/getList",method = RequestMethod.POST)
    public Result getList(@RequestBody Map<String,Object> map){
        return new Result(ResultCode.SUCCESS_NO_MESSAGE,ServiceFactory.dictionaryService.getList(map));
    }

    @RequestMapping(value = "/save",method = RequestMethod.POST)
    public Result save(@RequestBody Dictionary dictionary){
        return ServiceFactory.dictionaryService.save(dictionary);
    }

    @RequestMapping(value = "/update",method = RequestMethod.POST)
    public Result update(@RequestBody Dictionary dictionary){
        return ServiceFactory.dictionaryService.update(dictionary);
    }

    @RequestMapping(value = "/search",method = RequestMethod.POST)
    public Result search(@RequestBody Map<String,Object> map){
        return new Result(ResultCode.SUCCESS_NO_MESSAGE,ServiceFactory.dictionaryService.search(map));
    }
}
